feat: make public gateways optional for sharing - #1371
Merged
Conversation
lidel
force-pushed
the
feat/native-share-links
branch
from
July 2, 2026 01:25
013cfc5 to
c1691cd
Compare
Public gateway URLs are now empty by default, so "Copy Shareable Link" and friends copy native ipfs:// and ipns:// URIs. A new opt-in toggle restores public gateway URLs for sharing with people who do not run IPFS. - options: empty publicGatewayUrl/publicSubdomainGatewayUrl defaults plus usePublicGatewaysForShare (off, disabled until a public gateway URL is set) - ipfs-path: resolveToNativeUri plus toggle-aware resolveToShareableUrl and resolveToPermalink (Copy Shareable and Snapshot Link); resolveToPublicUrl falls back to native on empty gateway - public shareable links follow the "Use Subdomains" preference: on uses the subdomain gateway, off the path gateway, and whichever one is configured when only one is set - native URIs use case-insensitive roots since browsers treat them as origins: base32 CIDv1 for ipfs://, base36 libp2p-key CIDv1 for ipns:// peer ids (DNSLink hostnames unchanged) - empty gateways handled across state, request, dnslink, import and inspector: sameGateway/dropSlash are null-safe and browser-loading paths fall back to the local gateway - recovery page: with no public gateway configured it shows the native ipfs:// address, drops the public-gateway wording, and offers to install a local IPFS node - options UI: public gateway fields moved below the local gateway; path gateway renamed to make its shape explicit; both documented with link examples and links to the path/subdomain gateway specs
lidel
force-pushed
the
feat/native-share-links
branch
from
July 3, 2026 00:21
c1691cd to
79ab0da
Compare
Making public gateways optional left several consumers resolving to native ipfs:// URIs they could not use, and routed offline failures to dead ends. Degrade each consumer to a loadable URL or the recovery page. - resolveToPublicUrl: use the subdomain gateway for content paths when only it is set, keep subdomain requests native rather than downgrade them to a path gateway (origin isolation), and repair the ipns:// DNSLink protocol swap that URL.protocol assignment silently dropped - recovery: send failed requests to the recovery page with the native URI when no loadable gateway remains, including failures at the configured gateway itself; only reopen on the local gateway when the node is online; limit HTTP recovery to 5xx - preload: noop without a public gateway, otherwise pick a random configured one - linkify: fall back to the local gateway so injected hrefs stay http(s) - sharing: reset usePublicGatewaysForShare when both gateway URLs are cleared; share helpers no longer re-parse an already-decoded path - sameGateway: match on a label boundary so nondefaultipfs.io is not treated as ipfs.io
Match the defaults ipfs/ipfs-webui#2482 shipped: fresh installs prefill ipfs.io and dweb.link and copy dweb.link subdomain URLs, while clearing the gateway URLs switches copied links to native ipfs:// and ipns:// URIs. - options: defaults live in DEFAULT_* constants; a future flip to native-by-default changes those plus a migrateOptions entry - ipfs-path: share links prefer the subdomain gateway and fall back to the path gateway, then native; roots longer than the 63-char DNS label limit no longer produce hostnames that cannot resolve - options/store: clearing the last gateway URL no longer flips the share toggle off; the fallback is dynamic, so re-adding a URL restores public sharing - recovery: resolve a native URI via the background once the node is online instead of navigating to ipfs://, which Chromium drops - popup: show the local gateway address when no public one is set - locales/en: describe the new behavior on the Preferences screen
- rename lingering "custom gateway" mentions to "local gateway" - fix grammar in the automatic mode descriptions and a missing space in the notifications one
The node type select had a single option, so it asked users to choose nothing. Hide it while POSSIBLE_NODE_TYPES has one entry and instead explain what the Kubo RPC API is, with links to install Kubo or IPFS Desktop and to the RPC docs.
lidel
marked this pull request as ready for review
July 17, 2026 11:35
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
"Copy Shareable Link" always produced a URL on a third-party gateway, and parts of the extension assumed a public gateway is always set. There was no way to copy a native ipfs:// or ipns:// address, or to stop routing people through ipfs.io and dweb.link.
Fix
DEFAULT_*constants inlib/options.jsplus a migrationPreferences → Gateways
Preferences → IPFS Node
Recovery page
With no public gateway set and the node offline, the page shows the content's native address and offers to install a local node:
With a public gateway configured, it is unchanged and still offers to continue to that gateway:
Related